package mn.idax.exchange.otc.config;

import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.core.JmsMessagingTemplate;

/**
 * @Author: jack_huang
 * @Date: 2019/11/5 13:27
 */
@Configuration
public class AdProducter {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Value("${spring.activemq.AD_UP}")
    private String upAdTopic;

    @Value("${spring.activemq.AD_DOWN}")
    private String downAdTopic;

    public void sendUpAdMessage(String msg){
        ActiveMQTopic destination = new ActiveMQTopic(upAdTopic);
        jmsMessagingTemplate.convertAndSend(destination,msg);
    }

    public void sendDownAdMessage(String msg){
        ActiveMQTopic destination = new ActiveMQTopic(downAdTopic);
        jmsMessagingTemplate.convertAndSend(destination,msg);
    }



}
